import java.util.HashSet;
import java.util.Set;

public class Solution771 {
    public int numJewelsInStones(String jewels, String stones) {
        Set<Character> set=new HashSet<>();
        for (char c : jewels.toCharArray()) {
            set.add(c);
        }
        int ans=0;
        for (char c : stones.toCharArray()) {
            if (set.contains(c)){
                ans++;
            }
        }
        return ans;
    }

    public static void main(String[] args) {
        System.out.println(new Solution771().numJewelsInStones("aA","aAAbbbb"));
    }
}
